# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=libdnet-ipv6
pkgver=1.12
pkgrel=3
pkgdesc="A simplified, portable interface to several low-level networking routines"
arch=('x86_64' 'aarch64')
makedepends=('python2')
optdepends=('python2')
provides=('libdnet')
conflicts=('libdnet')
license=('BSD')
url='http://code.google.com/p/libdnet/'
source=("https://github.com/dugsong/libdnet/archive/libdnet-$pkgver.tar.gz"
        'ipv6.patch')
sha512sums=('a2410a98b76d4bccecf7bcb82ff0b6e9fb809b389f7fea938cc42d94e18622cc5f353d2de737121a1990d9e16e9db8cc2f82677c94f78cd03c9227e815eab9e0'
            '3f9eb49a54172bae25ab6f137020c9babcb6fdb888d8b27050bfbdb87986de83df7fe81d783068d61fa33cd803fecd74d0f9acaf26c4991585609787e783b3be')

prepare() {
  cd "libdnet-$pkgver"

  patch -p1 -i "$srcdir/ipv6.patch"
}

build() {
  cd "libdnet-$pkgver"

  autoreconf -I config --force --install

  ./configure --prefix=/usr --sbindir=/usr/bin

  make
}

package() {
  cd "libdnet-$pkgver"

  make DESTDIR="$pkgdir" install

  cd python

  python2 setup.py install --root="$pkgdir"

  install -Dm 644 ../LICENSE "$pkgdir/usr/share/licenses/libdnet/LICENSE"
}

